import cv2

img = cv2.imread('../asset/cube2.jpeg')
img_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

ret, binary = cv2.threshold(img_gray, 150, 255, cv2.THRESH_BINARY)

# contours, hierarchy = cv2.findContours(binary, cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE)
contours, hierarchy = cv2.findContours(binary, cv2.RETR_TREE, cv2.CHAIN_APPROX_NONE)
# cv2.drawContours(img, contours, -1, (0, 255, 0), -1)
# cv2.drawContours(img, contours, -1, (0, 255, 0), 1)
cv2.drawContours(img, contours[1], -1, (0, 255, 0), 6)
print(contours)
while True:
    cv2.imshow('img', img)
    key = cv2.waitKey(10)
    if key & 0xFF == ord('q'):
        break
cv2.destroyAllWindows()
